<?php
//
//保留相同键名的所有值
$ar1 = array('A'=>4,"color" => array("favorite" => "red"), 5);
$ar2 = array('A'=>5,10, "color" => array("favorite" => "green", "blue"));
$result = array_merge_recursive($ar1, $ar2);
print_r($result);